package com.gaga.console.core.service.impl.multimodel;

import com.gaga.common.constant.BvConstants;
import com.gaga.common.enums.PlayerType;
import com.gaga.common.enums.SingleDoubleModelType;
import com.gaga.console.core.service.BvConfigService;
import com.gaga.console.core.service.SysConfigService;

/**
 * @author liujia
 * @version 1.0
 * @date 2025/4/9-10:03
 */
public class ModelFactory {

    public static ModelHandler getHandler(PlayerType playerType, SysConfigService sysConfigService, BvConfigService bvConfigService, String modelPath, String sovitsUrl, String gptUrl) {
        AbstractModelHandler modelHandler = null;
        // 从sysconfig表中获取双模型开关状态
        String openDoubleModelStr = sysConfigService.getConfigValueByKey(BvConstants.SINGLE_DOUBLE_MODEL);
        SingleDoubleModelType byCode = SingleDoubleModelType.getByCode(openDoubleModelStr);

        // 双模型模式，根据角色类型选择不同的模型
        switch (playerType) {
            case ANCHOR:
                modelHandler = new AnchorModelHandler();
                break;
            case ASSISTANT:
                modelHandler = new AssitantModelHandler();
                break;
            default:
                modelHandler = new AnchorModelHandler();
                break;
        }

        modelHandler.init(sysConfigService, modelPath, sovitsUrl, gptUrl, byCode);
        return modelHandler;
    }

}
